<?php

class Soul_Validation_Rule_RangeValue extends Soul_Validation_Rule_Base {

	private $_max = NULL;
	private $_min = NULL;	
	
    public function  __construct($min = NULL, $max = NULL) {
        parent::__construct();
        $this->_min = $min;
        $this->_max = $max;
    }
    
    public function getMax($value){
    	return $this->_max;
    }    
    public function setMax($value){
    	$this->_max = $value;
    }
    
    public function getMin(){
    	return $this->_min;
    }
    public function setMin($value){
    	$this->_min = $value;
    }

    public function getType(){
        return 'rangeValue';
    }

    public function check($value) {
        if(is_numeric($this->getMin()) && $value < $this->getMin()){
            return FALSE;
        }

        if(is_numeric($this->getMax()) && $value > $this->getMax()){
            return FALSE;
        }

        return TRUE;
    }
}